<!DOCTYPE html>
<!-- release v4.3.6, copyright 2014 - 2017 Kartik Visweswaran -->
<html lang="en">
    <head>
        <meta charset="UTF-8"/>
        <title>{$title}</title>
        <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
        <link rel="stylesheet" type="text/css" href="/public/upload/css/default.css">
        <link href="/public/upload/css/fileinput.css" media="all" rel="stylesheet" type="text/css" />
        <script src="http://cdn.bootcss.com/jquery/1.11.0/jquery.min.js" type="text/javascript"></script>
        <script>window.jQuery || document.write('<script src="js/jquery-1.11.0.min.js"><\/script>')</script>
        <!--<script src="/public/upload/js/fileinput.js" type="text/javascript"></script>-->
        <!--简体中文-->
        <script src="/public/upload/js/locales/zh.js" type="text/javascript"></script>
        <!--繁体中文-->
        <script src="/public/upload/js/locales/zh-TW.js" type="text/javascript"></script>
        <script src="http://cdn.bootcss.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>

    </head>
    <body >
            <div class="htmleaf-container" >

                <div class="container kv-main" style="width: 80%;">
                    <div class="page-header">
                    <h2>上传封面图片和实验视频(视频仅支持MP4格式)--如果只修改封面，则只需上传封面图片即可</h2>
                    </div>

                    <form enctype="multipart/form-data" method="post" action="/admin.php/admin/experiment/form_video">
                        <input type="hidden" name="tip" value="1">
                        <input type="hidden" name="e_id" value="{$e_id}">
                        <label>选择封面图片</label>
                        <input id="file-0a" name="picture" class="file" type="file" multiple data-min-file-count="2">
                        <br>
                        <label>选择视频（选择后可以预览）</label>
                        <input id="file-0b" name="video" class="file" type="file" multiple data-min-file-count="1">
                        <br>
                        <button type="submit" class="btn btn-primary">上传</button>
                        <button type="button" onclick="location.href='/admin.php/admin/experiment';" class="btn btn-default">返回</button>
                    </form>
                    <br>
                    <br>
            </div>
    </body>
	<script>
    $("#file-0").fileinput({
        'allowedFileExtensions' : ['jpg', 'png','gif'],
    });
    $("#file-1").fileinput({
        allowedFileExtensions : ['jpg', 'png','gif','mp4'],
        overwriteInitial: false,
        maxFileSize: 1000,
        maxFilesNum: 10,
        //allowedFileTypes: ['image', 'video', 'flash'],
        slugCallback: function(filename) {
            return filename.replace('(', '_').replace(']', '_');
        }
	});
    /*
    $(".file").on('fileselect', function(event, n, l) {
        alert('File Selected. Name: ' + l + ', Num: ' + n);
    });
    */
	$("#file-3").fileinput({
		showUpload: false,
		showCaption: false,
		browseClass: "btn btn-primary btn-lg",
		fileType: "any",
        previewFileIcon: "<i class='glyphicon glyphicon-king'></i>"
	});
	$("#file-4").fileinput({
		uploadExtraData: {kvId: '10'}
	});
    $(".btn-warning").on('click', function() {
        if ($('#file-4').attr('disabled')) {
            $('#file-4').fileinput('enable');
        } else {
            $('#file-4').fileinput('disable');
        }
    });    
    $(".btn-info").on('click', function() {
        $('#file-4').fileinput('refresh', {previewClass:'bg-info'});
    });
    /*
    $('#file-4').on('fileselectnone', function() {
        alert('Huh! You selected no files.');
    });
    $('#file-4').on('filebrowse', function() {
        alert('File browse clicked for #file-4');
    });
    */
    $(document).ready(function() {
        $("#test-upload").fileinput({
            'showPreview' : false,
            'allowedFileExtensions' : ['jpg', 'png','gif','mp4'],
            'elErrorContainer': '#errorBlock'
        });
        /*
        $("#test-upload").on('fileloaded', function(event, file, previewId, index) {
            alert('i = ' + index + ', id = ' + previewId + ', file = ' + file.name);
        });
        */
    });
	</script>
</html>